import Layout from '../views/layout/Layout'
import store from '../store'

import _zhis_ from '@/api/mode'





var adminss =
 [
  { path: '/login', component: () => import('@/views/login/index'), hidden: true },
  { path: '/404', component: () => import('@/views/404'), hidden: true },

  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    name: 'Dashboard',
    hidden: true,
    children: [{
      path: 'dashboard',
      component: () => import('@/views/dashboard/index')
    }]
  },
  {
    path: '/eduteacher',
    component: Layout,
    redirect: '/eduteacher/list',
    name: '讲师管理',
    meta: { title: '讲师管理', icon: 'user' },
    children: [
      {
        path: 'list',
        name: '讲师列表',
        component: () => import('@/views/edu/teacher/index'),
        meta: { title: '讲师列表', icon: 'table' }
      },
      {
        path: 'save',
        name: '添加讲师',
        component: () => import('@/views/edu/teacher/save'),
        meta: { title: '新建讲师', icon: 'tree' }
      },
      {
        path: 'edit/:id',
        name: '修改讲师',
        component: () => import('@/views/edu/teacher/save'),
        meta: { title: '修改讲师', icon: 'tree' },
        hidden: true
      }
    ]
  },
  {
    path: '/subject',
    component: Layout,
    redirect: '/subject/list',
    name: '课程分类管理',
    meta: { title: '课程分类管理', icon: 'nested' },
    children: [
      {
        path: 'list',
        name: '课程分类列表',
        component: () => import('@/views/edu/subject/list'),
        meta: { title: '课程分类列表', icon: 'tree' }
      },
      {
        path: 'import',
        name: '课程分类导入',
        component: () => import('@/views/edu/subject/import'),
        meta: { title: '课程分类导入', icon: 'table' }
      }
    ]
  },
  {
    path: '/course',
    component: Layout,
    redirect: '/edu/course/list',
    name: 'Course',
    meta: { title: '课程管理', icon: 'form' },
    children: [
      {
        path: 'list',
        name: 'EduCourseList',
        component: () => import('@/views/edu/course/list'),
        meta: { title: '课程列表' }
      },
      {
        path: 'info',
        name: 'EduCourseInfo',
        component: () => import('@/views/edu/course/info'),
        meta: { title: '发布课程' }
      },
      {
        path: 'info/:id',
        name: 'EduCourseInfoEdit',
        component: () => import('@/views/edu/course/info'),
        meta: { title: '编辑课程基本信息', noCache: true },
        hidden: true
      },
      {
        path: 'chapter/:id',
        name: 'EduCourseChapterEdit',
        component: () => import('@/views/edu/course/chapter'),
        meta: { title: '编辑课程大纲', noCache: true },
        hidden: true
      },
      {
        path: 'publish/:id',
        name: 'EduCoursePublishEdit',
        component: () => import('@/views/edu/course/publish'),
        meta: { title: '发布课程', noCache: true },
        hidden: true
      }
    ]
  },
  {
    path: '/statistics',
    component: Layout,
    redirect: '/statistics/daydate',
    name: '系统管理',
    meta: { title: '学生管理', icon: 'nested' },
    children: [
      {
        path: 'daydate',
        name: '学生信息',
        component: () => import('@/views/edu/student/list'),
        meta: { title: '学生列表', icon: 'tree' }
      },
      {
        path: 'import',
        name: '课程详情',
        component: () => import('@/views/edu/student/chart'),
        meta: { title: '添加学生', icon: 'table' },
        // hidden:true
      },
      {
        path: 'edt/:id',
        name: '用户详情',
        component: () => import('@/views/edu/student/add'),
        meta: { title: '用户详情', icon: 'table' },
        hidden: true
      }
    ]
  },
  {
    path: '/stuteacher',
    component: Layout,
    redirect: '/stuteacher/list',
    name: '组织机构',
    meta: { title: '系统管理', icon: 'user' },
    children: [
      {
        path: 'list',
        name: '机构管理',
        component: () => import('@/views/edu/stu/index'),
        meta: { title: '组织机构',  }
      },{
        path: 'dict',
        name: '字典管理',
        component: () => import('@/views/sys/dict/list'),
        meta: { title: '数据字典', }
      },{
        path: 'add',
        name: '添加字典',
        component: () => import('@/views/sys/dict/add'),
        meta: { title: '添加字典',  },
        hidden: true
      },
      {
        path: 'add/:id',
        name: '添加字典',
        component: () => import('@/views/sys/dict/add'),
        meta: { title: '添加字典',  },
        hidden: true
      },
      {
        path: 'dictType',
        name: '字典类型管理',
        component: () => import('@/views/sys/dictType/lits'),
        meta: { title: '字典类型', }
      },{
        path: 'addDictType',
        name: '添加字典类型',
        component: () => import('@/views/sys/dictType/add'),
        meta: { title: '添加类型',  },
        hidden: true
      },
      {
        path: 'addDictType/:id',
        name: '添加字典类型',
        component: () => import('@/views/sys/dictType/add'),
        meta: { title: '添加类型',  },
        hidden: true
      },
      {
        path: 'listUser',
        name: '用户列表',
        component: () => import('@/views/edu/eduUser/list'),
        meta: { title: '用户管理',  },
        
      },
      {
        path: 'addUser',
        name: '添加用户',
        component: () => import('@/views/edu/eduUser/get'),
        meta: { title: '添加用户',  },
        hidden: true
      },
      {
        path: 'addUser/:id',
        name: '修改讲师',
        component: () => import('@/views/edu/eduUser/get'),
        meta: { title: '修改讲师', },
        hidden: true
      }

    ]
  },






  { path: '*', redirect: '/404', hidden: true }
]
var logs = [{ path: '/login', component: () => import('@/views/login/index'), hidden: true },
{ path: '/404', component: () => import('@/views/404'), hidden: true },
{
  path: '/',
  component: Layout,
  redirect: '/dashboard',
  name: 'Dashboard',
  hidden: true,
  children: [{
    path: 'dashboard',
    component: () => import('@/views/dashboard/index')
  }]
},
{
  path: '/stuteacher',
  component: Layout,
  redirect: '/stuteacher/list',
  name: '学生选课',
  meta: { title: '在线选课', icon: 'user' },
  children: [
    {
      path: 'list',
      name: '讲师列表',
      component: () => import('@/views/edu/stu/index'),
      meta: { title: '在线选课', icon: 'table' }
    },
    {
      path: 'stuedit/:id',
      name: '修改讲师',
      component: () => import('@/views/edu/stu/save'),
      meta: { title: '修改讲师', icon: 'tree' },
      hidden: true
    }
  ]
}

]

var log = [{ path: '/login', component: () => import('@/views/login/index'), hidden: true },
{ path: '/404', component: () => import('@/views/404'), hidden: true },
{
  path: '/',
  component: Layout,
  redirect: '/dashboard',
  name: 'Dashboard',
  hidden: true,
  children: [{
    path: 'dashboard',
    component: () => import('@/views/dashboard/Refresh')
  }]
}
]

export default {
  admins() {

    // console.log(store.state.user.type)
    if (store.state.user.type == "admin") {
      // console.log(store.state.user.type)
      return adminss
    } else if (store.state.user.type == "user") {
      return logs

    } else {
      return log
    }

  }

}

